package cn.thornbird.orgsync.service;

import cn.thornbird.orgsync.entity.Attachment;
import cn.thornbird.orgsync.exception.BadRequestException;
import cn.thornbird.orgsync.exception.InternalServerErrorException;
import cn.thornbird.orgsync.exception.NotFoundException;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

public interface AttachmentService {

    Attachment find(String id) throws NotFoundException;

    Attachment findByFileUrl(String fileUrl);

    void download(String attachmentId, HttpServletResponse response);

    void download(String attachmentId, String filename, DownloadCallback downloadCallback,
                  HttpServletResponse response);

    Attachment save(MultipartFile file) throws BadRequestException, InternalServerErrorException;

    Attachment move(String id) throws NotFoundException, InternalServerErrorException;

    Attachment delete(String id) throws NotFoundException;

    void deleteTemporaryAttachments() throws NotFoundException;

}
